/*
 * @Description: 日志详情
 * @Author: Rfan
 * @Date: 2022-09-19 17:37:05
 * @LastEditTime: 2022-09-19 17:46:09
 */

import { useEffect } from 'react';
import { Button, Form, Modal } from 'antd';
import type { FC } from 'react';
import type { ICommonDialog } from '@/interfaces/global';

interface IDetailDialogProps extends ICommonDialog {
  data: any;
}

const DetailDialog: FC<IDetailDialogProps> = (props) => {
  const { visible, data, onClose } = props;
  const [form] = Form.useForm();

  useEffect(() => {
    if (visible) {
      form.setFieldsValue(data);
    }
  }, [visible]);

  const onCancel = () => {
    onClose();
  };

  return (
    <Modal
      destroyOnClose
      title="详情"
      visible={visible}
      onCancel={onCancel}
      footer={[
        <Button
          key="submit"
          type="primary"
          onClick={() => {
            onCancel();
          }}
        >
          确认
        </Button>
      ]}
    >
      <Form
        labelCol={{ span: 6 }}
        wrapperCol={{ span: 14 }}
        preserve={false}
        initialValues={data}
        form={form}
      >
        <Form.Item label="文件所属层级">
          全宗名称{'>'}档案类型{'>'}案卷名称{'>'}文件名称
        </Form.Item>
        <Form.Item label="文件标题">XXXXXXXX.doc</Form.Item>
        <Form.Item label="转换前格式">doc</Form.Item>
        <Form.Item label="转换后格式">doc</Form.Item>
        <Form.Item label="转换结果">失败</Form.Item>
        <Form.Item label="操作者">XXX</Form.Item>
        <Form.Item label="操作时间">2022-9-19 17:43:19</Form.Item>
        <Form.Item label="创建时间">2022-9-19 17:43:25</Form.Item>
        <Form.Item label="失败原因">
          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        </Form.Item>
      </Form>
    </Modal>
  );
};
export default DetailDialog;
